package com.ruoyi.logistic.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.logistic.domain.HomeNavigationBar;
import com.ruoyi.logistic.service.IHomeNavigationBarService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/home")
@Api(tags = "主页")
public class HomeNavigationBarController {
    @Autowired
    private IHomeNavigationBarService homeNavigationBarService;

    @ApiOperation("查询三级导航")
    @GetMapping("/navigationBar")
    public R selectHomeNavigationBar() {
        List<HomeNavigationBar> homeNavigationBars = homeNavigationBarService.selectAll();
        if (homeNavigationBars == null || homeNavigationBars.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(homeNavigationBars);
        }
    }
}
